package io.adrainty.bolee.security.feign;

import io.adrainty.bolee.framework.commons.basic.ResultDTO;
import io.adrainty.bolee.framework.commons.user.UserEntity;
import io.adrainty.bolee.security.hystrix.CustomerFeignHystrix;
import io.adrainty.bolee.security.models.entity.CustomerEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * <p>ICustomerFeign</p>
 *
 * @author AdRainty
 * @version V1.0.0
 * @description ICompanyFeign
 * @since 2025/8/5 00:17:35
 */


@FeignClient(value = "security-web", path = "/customer-feign", fallback = CustomerFeignHystrix.class)
public interface ICustomerFeign {

    /**
     * 按照客户查找用户
     *
     * @param username 用户名
     * @param company  公司
     * @return 用户
     */
    @PostMapping("/username-login/{username}/{company}")
    ResultDTO<UserEntity> usernameLogin(@PathVariable("username") String username, @PathVariable("company") String company);

    /**
     * 按照手机号查找用户
     *
     * @param mobile  手机号
     * @param company 公司
     * @return 用户
     */
    @PostMapping("/mobile-login/{mobile}/{company}")
    ResultDTO<UserEntity> mobileLogin(@PathVariable("mobile") String mobile, @PathVariable("company") String company);

    /**
     * 微信登录
     *
     * @param openId  微信openId
     * @param company 公司
     * @return 用户
     */
    @PostMapping("/wechat-login/{openId}/{company}")
    ResultDTO<UserEntity> wechatLogin(@PathVariable("openId") String openId, @PathVariable("company") String company);

    /**
     * 注册用户
     *
     * @param customerVO 客户信息
     * @return 注册结果
     */
    @PostMapping("/register-user")
    ResultDTO<UserEntity> registerUser(@RequestBody CustomerEntity customerVO);

    /**
     * 重置密码
     *
     * @param customerId 客户ID
     * @return 重置结果
     */
    @PostMapping("reset-passwords/{customerId}")
    ResultDTO<Boolean> resetPasswords(@PathVariable("customerId") String customerId);

    /**
     * 修改真实姓名
     *
     * @param userId 用户ID
     * @param name   真实姓名
     * @return 修改结果
     */
    @PostMapping("/update-real-name")
    ResultDTO<Boolean> updateRealName(@RequestParam("userId") String userId, @RequestParam("name") String name);

}
